package com.musemun.pojo;

import com.musemun.exception.MyDefineException;
import lombok.Data;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

@Repository
public class EmployeeRepository {
    public static final Map<String,Employee> map=new ConcurrentHashMap<>();
    public Employee findByUsername(final String username){
        return map.get(username);
    }

    public Employee insert(Employee user){
        map.put(user.getUsername(),user);
        return user;
    }
    public Employee remove(String username){
       return map.remove(username);
    }
}
